package actions;

import interfaces.impl.Action;


import extra.Position;
import constants.*;
import factoryNCastle.ObjectFactory;
import objects.WorldObject;
import universe.Universe;

public class ActionGenerateObject extends Action{
	
	private double x;
	private double y;
	private int ObjectReference;
	
	

	public ActionGenerateObject(){
		super();
		this.id=Constants.ACTION_GENERATE_OBJECT;
	}
	public ActionGenerateObject(int priority){
		super(priority);
		this.id=Constants.ACTION_GENERATE_OBJECT;
	}
	
	
	@Override
	public boolean processAction(Universe world) {
		
		
		WorldObject object = ObjectFactory.createWorldObject(ObjectReference);
		object.setPosition(new Position(x, y));
		
		if(target!=null){
			//target.addObject(object);
			world.getListObjectsToAdd().add(object);
		}
		
		

		return false;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "Action Generate Object";
	}
	public double getX() {
		return x;
	}
	public void setX(double x) {
		this.x = x;
	}
	public double getY() {
		return y;
	}
	public void setY(double y) {
		this.y = y;
	}
	public int getObjectReference() {
		return ObjectReference;
	}
	public void setObjectReference(int objectReference) {
		ObjectReference = objectReference;
	}
	

}
